package com.yanyeori.webtest.mapstruct;

import com.yanyeori.framework.core.util.DateUtil;
import com.yanyeori.webtest.bo.LoginLogBO;
import com.yanyeori.webtest.entity.yanye.LoginLogEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author chenkuan
 * @since 2022/6/20
 */
@Mapper(imports = {DateUtil.class})
public interface LoginLogStructMapper {
    LoginLogStructMapper INSTANCE = Mappers.getMapper(LoginLogStructMapper.class);

    @Mapping(target = "loginTimeStr", expression = "java(DateUtil.format(loginLogEntity.getLoginTime(), \"yyyy-MM-dd HH:mm:ss\"))")
    LoginLogBO entityToBO(LoginLogEntity loginLogEntity);

    List<LoginLogBO> entityListToBOList(List<LoginLogEntity> loginLogEntityList);
}
